package ar.uba.fi.algo3.auxiliares;

public class Posicion {
	
	private int x;
    private int y;
        
    public Posicion(int x, int y) {
    	this.setPosicion(x, y);
    }

    public int getX() {
        return this.x;
    }

    public void setX(int x){    
		this.x=x;
	}

	public void setY(int y){
        
		this.y=y;
	}
    public int getY() {
    	return this.y;
    }
    
    public void setPosicion(int x, int y) {
            this.x = x;
            this.y = y;
    }    
   	
	public Posicion getPosicion(){
        return (new Posicion (this.getX(),this.getY()));
	}
	
	public Posicion posSiguiente() {
		
        return this.avanzar(1,0);
	}

	public Posicion posAnterior() {
		
        return this.avanzar(-1,0);
	}

	private Posicion avanzar(int i, int j) {
    
		return (new Posicion (this.x+i,this.y+j));              
	}
	
	public boolean esIgualA(Object posicion){
	      	       
		boolean igual = false;       
	        	
	    if ( this.getX() == ((Posicion) posicion).getX() && this.getY() == ((Posicion) posicion).getY()){
	                 
	    	igual = true;
	   	}
	    return igual;                                            
	}	
}
